﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace webchart.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        public ActionResult Index()
        {
            return View();
        }

        public JsonResult Login()
        {
            string userName = Request["username"];
            string passWord = Request["password"];
            if (userName == "kun" && passWord == "123")
            {
                return Json("ok", JsonRequestBehavior.AllowGet);
                //return "ok";
            }
            return Json("error",JsonRequestBehavior.AllowGet);
            //return "error";
        }

        public JsonResult UploadFile()
        {
            string filePath = Request["filePath"];
            string name = Request["name"];
            string formData = Request["formData"];
            System.IO.File.WriteAllText("c:\\result\\a.txt", filePath);
            System.IO.File.WriteAllText("c:\\result\\b.txt", name);
            System.IO.File.WriteAllText("c:\\result\\c.txt", formData);
            return Json("ok", JsonRequestBehavior.AllowGet);
        }
    }
}